package fzdy.core.typeConversion;

/**
 * Created by Administrator on 2017/3/27 0027.
 */

import org.springframework.format.Formatter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DateFormat implements Formatter<Long> {
    protected SimpleDateFormat ymd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public DateFormat() {
    }

    public Long parse(String s, Locale locale) throws ParseException {
        Date parse = this.ymd.parse(s + " 23:59:59");
        return Long.valueOf(parse.getTime());
    }

    public String print(Long aLong, Locale locale) {
        return aLong.toString();
    }
}
